package com.xinlong.service;

import com.github.pagehelper.PageInfo;
import com.xinlong.entity.SchedulerJob;
import java.util.List;

public interface SchedulerService {
    int OPTION_SUCCESS = 0;
    int JOB_NOT_FOUND = 1;

    /**
     * 根据Trigger 状态进行分页查询
     * @param page
     * @param size
     * @param triggerStatus
     * @return
     */
    PageInfo<SchedulerJob> show(int page, int size,int triggerStatus) throws Exception;

    /**
     * 添加定时任务
     * @param job
     * @return
     */
    int add(SchedulerJob job) throws Exception;

    /**
     * 删除定时任务
     * @param name
     * @param group
     * @return
     * @throws Exception
     */
    int delete(String name,String group) throws Exception;

    /**
     * 暂停任务
     * @param name
     * @param group
     * @throws Exception
     */
    int pause(String name,String group)throws Exception;

    /**
     * 恢复任务
     * @param name
     * @param group
     * @return
     * @throws Exception
     */
    int resume(String name,String group) throws Exception;

    /**
     * 现在执行
     * @param name
     * @param group
     * @return
     * @throws Exception
     */
    int execute(String name,String group) throws Exception;

    /**
     * 查询任务信息
     * @param name
     * @param group
     * @return
     * @throws Exception
     */
    SchedulerJob selByNameAndGroup(String name,String group)throws Exception;

}
